/*** 
 * @_______________#########_______________________ 
 * @______________############_____________________ 
 * @______________#############____________________ 
 * @_____________##__###########___________________ 
 * @____________###__######_#####__________________ 
 * @____________###_#######___####_________________ 
 * @___________###__##########_####________________ 
 * @__________####__###########_####_______________ 
 * @________#####___###########__#####_____________ 
 * @_______######___###_########___#####___________ 
 * @_______#####___###___########___######_________ 
 * @______######___###__###########___######_______ 
 * @_____######___####_##############__######______ 
 * @____#######__#####################_#######_____ 
 * @____#######__##############################____ 
 * @___#######__######_#################_#######___ 
 * @___#######__######_######_#########___######___ 
 * @___#######____##__######___######_____######___ 
 * @___#######________######____#####_____#####____ 
 * @____######________#####_____#####_____####_____ 
 * @_____#####________####______#####_____###______ 
 * @______#####______;###________###______#________ 
 * @________##_______####________####______________ 
 * @
 * @Author: ipk518 121206530@qq.com
 * @Date: 2025-06-04 15:46:29
 * @LastEditors: ipk518 121206530@qq.com
 * @LastEditTime: 2025-06-04 15:47:58
 * @FilePath: /etws-sxk2307/tools/gnss/gnss_data.h
 * @Description: 
 * @你把时间投在专业上，两三年，你就能在圈子里小有名气。四五年，你就能靠这个专业赚钱。过了10年以上，你就能成为这个领域的专家
 * @Copyright (c) 2025 by etws@quyujiang, All Rights Reserved. 
 */

#ifndef __GNSS_DATA_H__
#define __GNSS_DATA_H__



#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>



#define GNSS_NMEA_RMC_DATA_BYTE 13
#define GNSS_NMEA_GGA_DATA_BYTE 14

typedef struct __attribute__ ((__packed__))
{
  struct __attribute__ ((__packed__))
  {
    char utc_time[9];             // hhmmss.sss格式
    char location_status;      // A=定位，V=未定 ???????
    char latitude[10];            //纬度ddmm.mmmm，度分格 ???????(前导位数不足则补0)
    char latitude_latitude;    //纬度N(北纬)或S(南纬)
    char longitude[11];           //经度dddmm.mmmm，度分格 ???????(前导位数不足则补0)
    char longitude_latitude;   //经度E(东经)或W(西经)
    char speed[5];                // Knots( ???????节也 ???????1.852千米／小 ???????)
    char azimuth[5];              //方位 ???????
    char utc_data[6];             // DDMMYY格式
    char magnetic_declination[4]; //磁偏角方向，E=东，W= ???????
    char magnetic_declination_latitude[4];
    char location_mode; // A=自动，D=差分，E=估测，N=数据无效(3.0协议内容)
    char navStatus;
  } gnrmc;
  struct __attribute__ ((__packed__))
  {
    char utc_time[9];            
    char latitude[10];            
    char latitude_latitude;    
    char longitude[11];           
    char longitude_latitude;   
    char quality;
    char numSV[2];
    char hdop[4];
    char alt[6];
    char altunit;
    char sep[5];
    char sepUnit;
    char diffAge;
    char diffStation[2];
  } gngga;
  struct __attribute__ ((__packed__))
  {
    uint32_t relPosLength; 
    uint32_t accLength;
    uint32_t relPosHeading;
    uint32_t accHeading;
  } ubx_nav_relposned;
  struct __attribute__ ((__packed__))
  {
    uint16_t herder; 
    uint8_t  order_code;
    uint16_t length;
    char utc_time[9];
    char location_status;
    char latitude[10];            
    char latitude_latitude;    
    char longitude[11];           
    char longitude_latitude;
    char alt[6];
    uint32_t relPosLength; 
    uint32_t accLength;
    uint32_t relPosHeading;
    uint32_t accHeading;
    char utc_data[6];
    uint16_t crc;
  } gnss_data_output;
} gnss_data_struct;
extern gnss_data_struct gnss_data;

#endif